<?php

namespace common\models\kingdee;

use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\kingdee\OrgAdmin;

/**
 * OrgAdminSearch represents the model behind the search form about `common\models\kingdee\OrgAdmin`.
 */
class OrgAdminSearch extends OrgAdmin
{
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['FID', 'FNAME_L1', 'FNAME_L2', 'FNAME_L3', 'FNUMBER', 'FDESCRIPTION_L1', 'FDESCRIPTION_L2', 'FDESCRIPTION_L3', 'FSIMPLENAME', 'FEFFECTDATE', 'FINVALIDDATE', 'FCREATORID', 'FCREATETIME', 'FLASTUPDATEUSERID', 'FLASTUPDATETIME', 'FCONTROLUNITID', 'FLONGNUMBER', 'FPARENTID', 'FPHONENUMBER', 'FLAYERID', 'FRESPONPOSITIONID', 'FADDRESSID', 'FPRINCIPALID', 'FLAYERTYPEID', 'FBASEDUTY_L1', 'FBASEDUTY_L2', 'FBASEDUTY_L3', 'FJOBSYSTEMID', 'FADMINADDRESS_L1', 'FADMINADDRESS_L2', 'FADMINADDRESS_L3', 'FZIPCODE', 'FFAX', 'FDISPLAYNAME_L1', 'FDISPLAYNAME_L2', 'FDISPLAYNAME_L3', 'FPROPERTYSEALUPDATE', 'FVERSIONNUMBER', 'FCODE', 'FSORTCODE', 'FINDUSTRYID', 'FREGISTEREDCODE', 'FSETUPDATE', 'FENDUPDATE', 'FTAXNUMBER', 'FJURIDICALPERSONID', 'FTERRITORY_L1', 'FTERRITORY_L2', 'FTERRITORY_L3', 'FORGCODE', 'FAREAID', 'FORGPROPERTYID', 'FREGISTTYPEID', 'FEFFDT', 'FLEFFDT', 'FHISTORYRELATEID', 'FDELEGATEHRID', 'FORGFUNCTIONID', 'FCOMPANYID', 'FDEPARTMENTID', 'FOFFICEID', 'FLEVELFOURGROUPID', 'FLEVELFIVEGROUPID', 'FLEVELFIVEGROUP', 'FLEVELSIXGROUPID', 'FRESERVEFIELDFIRST', 'FRESERVEFIELDSECOND', 'FRESERVEITEMFIRST', 'FRESERVEITEMSECOND', 'FORGTYPESTR'], 'safe'],
            [['FISGROUPING', 'FISFREEZE', 'FISCOMPANYORGUNIT', 'FISADMINORGUNIT', 'FISSALEORGUNIT', 'FISPURCHASEORGUNIT', 'FISSTORAGEORGUNIT', 'FISPROFITORGUNIT', 'FISCOSTORGUNIT', 'FISCU', 'FISUNION', 'FISHRORGUNIT', 'FISLEAF', 'FLEVEL', 'FISENTITY', 'FISVIRTUAL', 'FINDEX', 'FISSEALUP', 'FISSTART', 'FISOUSEALUP', 'FISTRANSPORTORGUNIT', 'FISQUALITYORGUNIT', 'FECONOMICTYPE', 'FISCHURCHYARD', 'FISJURIDICALCOMPANY', 'FISINDEPENDENCE', 'FISSTARTSHR'], 'integer'],
            [['FREGISTEREDCAPITAL'], 'number'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function scenarios()
    {
        // bypass scenarios() implementation in the parent class
        return Model::scenarios();
    }

    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = OrgAdmin::find();

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
            'FISGROUPING' => $this->FISGROUPING,
            'FEFFECTDATE' => $this->FEFFECTDATE,
            'FINVALIDDATE' => $this->FINVALIDDATE,
            'FISFREEZE' => $this->FISFREEZE,
            'FISCOMPANYORGUNIT' => $this->FISCOMPANYORGUNIT,
            'FISADMINORGUNIT' => $this->FISADMINORGUNIT,
            'FISSALEORGUNIT' => $this->FISSALEORGUNIT,
            'FISPURCHASEORGUNIT' => $this->FISPURCHASEORGUNIT,
            'FISSTORAGEORGUNIT' => $this->FISSTORAGEORGUNIT,
            'FISPROFITORGUNIT' => $this->FISPROFITORGUNIT,
            'FISCOSTORGUNIT' => $this->FISCOSTORGUNIT,
            'FISCU' => $this->FISCU,
            'FISUNION' => $this->FISUNION,
            'FISHRORGUNIT' => $this->FISHRORGUNIT,
            'FCREATETIME' => $this->FCREATETIME,
            'FLASTUPDATETIME' => $this->FLASTUPDATETIME,
            'FISLEAF' => $this->FISLEAF,
            'FLEVEL' => $this->FLEVEL,
            'FISENTITY' => $this->FISENTITY,
            'FISVIRTUAL' => $this->FISVIRTUAL,
            'FINDEX' => $this->FINDEX,
            'FISSEALUP' => $this->FISSEALUP,
            'FISSTART' => $this->FISSTART,
            'FISOUSEALUP' => $this->FISOUSEALUP,
            'FPROPERTYSEALUPDATE' => $this->FPROPERTYSEALUPDATE,
            'FISTRANSPORTORGUNIT' => $this->FISTRANSPORTORGUNIT,
            'FISQUALITYORGUNIT' => $this->FISQUALITYORGUNIT,
            'FECONOMICTYPE' => $this->FECONOMICTYPE,
            'FREGISTEREDCAPITAL' => $this->FREGISTEREDCAPITAL,
            'FSETUPDATE' => $this->FSETUPDATE,
            'FENDUPDATE' => $this->FENDUPDATE,
            'FISCHURCHYARD' => $this->FISCHURCHYARD,
            'FISJURIDICALCOMPANY' => $this->FISJURIDICALCOMPANY,
            'FISINDEPENDENCE' => $this->FISINDEPENDENCE,
            'FEFFDT' => $this->FEFFDT,
            'FLEFFDT' => $this->FLEFFDT,
            'FISSTARTSHR' => $this->FISSTARTSHR,
        ]);

        $query->andFilterWhere(['like', 'FID', $this->FID])
            ->andFilterWhere(['like', 'FNAME_L1', $this->FNAME_L1])
            ->andFilterWhere(['like', 'FNAME_L2', $this->FNAME_L2])
            ->andFilterWhere(['like', 'FNAME_L3', $this->FNAME_L3])
            ->andFilterWhere(['like', 'FNUMBER', $this->FNUMBER])
            ->andFilterWhere(['like', 'FDESCRIPTION_L1', $this->FDESCRIPTION_L1])
            ->andFilterWhere(['like', 'FDESCRIPTION_L2', $this->FDESCRIPTION_L2])
            ->andFilterWhere(['like', 'FDESCRIPTION_L3', $this->FDESCRIPTION_L3])
            ->andFilterWhere(['like', 'FSIMPLENAME', $this->FSIMPLENAME])
            ->andFilterWhere(['like', 'FCREATORID', $this->FCREATORID])
            ->andFilterWhere(['like', 'FLASTUPDATEUSERID', $this->FLASTUPDATEUSERID])
            ->andFilterWhere(['like', 'FCONTROLUNITID', $this->FCONTROLUNITID])
            ->andFilterWhere(['like', 'FLONGNUMBER', $this->FLONGNUMBER])
            ->andFilterWhere(['like', 'FPARENTID', $this->FPARENTID])
            ->andFilterWhere(['like', 'FPHONENUMBER', $this->FPHONENUMBER])
            ->andFilterWhere(['like', 'FLAYERID', $this->FLAYERID])
            ->andFilterWhere(['like', 'FRESPONPOSITIONID', $this->FRESPONPOSITIONID])
            ->andFilterWhere(['like', 'FADDRESSID', $this->FADDRESSID])
            ->andFilterWhere(['like', 'FPRINCIPALID', $this->FPRINCIPALID])
            ->andFilterWhere(['like', 'FLAYERTYPEID', $this->FLAYERTYPEID])
            ->andFilterWhere(['like', 'FBASEDUTY_L1', $this->FBASEDUTY_L1])
            ->andFilterWhere(['like', 'FBASEDUTY_L2', $this->FBASEDUTY_L2])
            ->andFilterWhere(['like', 'FBASEDUTY_L3', $this->FBASEDUTY_L3])
            ->andFilterWhere(['like', 'FJOBSYSTEMID', $this->FJOBSYSTEMID])
            ->andFilterWhere(['like', 'FADMINADDRESS_L1', $this->FADMINADDRESS_L1])
            ->andFilterWhere(['like', 'FADMINADDRESS_L2', $this->FADMINADDRESS_L2])
            ->andFilterWhere(['like', 'FADMINADDRESS_L3', $this->FADMINADDRESS_L3])
            ->andFilterWhere(['like', 'FZIPCODE', $this->FZIPCODE])
            ->andFilterWhere(['like', 'FFAX', $this->FFAX])
            ->andFilterWhere(['like', 'FDISPLAYNAME_L1', $this->FDISPLAYNAME_L1])
            ->andFilterWhere(['like', 'FDISPLAYNAME_L2', $this->FDISPLAYNAME_L2])
            ->andFilterWhere(['like', 'FDISPLAYNAME_L3', $this->FDISPLAYNAME_L3])
            ->andFilterWhere(['like', 'FVERSIONNUMBER', $this->FVERSIONNUMBER])
            ->andFilterWhere(['like', 'FCODE', $this->FCODE])
            ->andFilterWhere(['like', 'FSORTCODE', $this->FSORTCODE])
            ->andFilterWhere(['like', 'FINDUSTRYID', $this->FINDUSTRYID])
            ->andFilterWhere(['like', 'FREGISTEREDCODE', $this->FREGISTEREDCODE])
            ->andFilterWhere(['like', 'FTAXNUMBER', $this->FTAXNUMBER])
            ->andFilterWhere(['like', 'FJURIDICALPERSONID', $this->FJURIDICALPERSONID])
            ->andFilterWhere(['like', 'FTERRITORY_L1', $this->FTERRITORY_L1])
            ->andFilterWhere(['like', 'FTERRITORY_L2', $this->FTERRITORY_L2])
            ->andFilterWhere(['like', 'FTERRITORY_L3', $this->FTERRITORY_L3])
            ->andFilterWhere(['like', 'FORGCODE', $this->FORGCODE])
            ->andFilterWhere(['like', 'FAREAID', $this->FAREAID])
            ->andFilterWhere(['like', 'FORGPROPERTYID', $this->FORGPROPERTYID])
            ->andFilterWhere(['like', 'FREGISTTYPEID', $this->FREGISTTYPEID])
            ->andFilterWhere(['like', 'FHISTORYRELATEID', $this->FHISTORYRELATEID])
            ->andFilterWhere(['like', 'FDELEGATEHRID', $this->FDELEGATEHRID])
            ->andFilterWhere(['like', 'FORGFUNCTIONID', $this->FORGFUNCTIONID])
            ->andFilterWhere(['like', 'FCOMPANYID', $this->FCOMPANYID])
            ->andFilterWhere(['like', 'FDEPARTMENTID', $this->FDEPARTMENTID])
            ->andFilterWhere(['like', 'FOFFICEID', $this->FOFFICEID])
            ->andFilterWhere(['like', 'FLEVELFOURGROUPID', $this->FLEVELFOURGROUPID])
            ->andFilterWhere(['like', 'FLEVELFIVEGROUPID', $this->FLEVELFIVEGROUPID])
            ->andFilterWhere(['like', 'FLEVELFIVEGROUP', $this->FLEVELFIVEGROUP])
            ->andFilterWhere(['like', 'FLEVELSIXGROUPID', $this->FLEVELSIXGROUPID])
            ->andFilterWhere(['like', 'FRESERVEFIELDFIRST', $this->FRESERVEFIELDFIRST])
            ->andFilterWhere(['like', 'FRESERVEFIELDSECOND', $this->FRESERVEFIELDSECOND])
            ->andFilterWhere(['like', 'FRESERVEITEMFIRST', $this->FRESERVEITEMFIRST])
            ->andFilterWhere(['like', 'FRESERVEITEMSECOND', $this->FRESERVEITEMSECOND])
            ->andFilterWhere(['like', 'FORGTYPESTR', $this->FORGTYPESTR]);

        return $dataProvider;
    }
}
